#include <ezwin.h>
#include <cmath>
#include <cassert>
#include "rect.h"
SimpleWindow window("GraphPlotter",28.0,20.0,Position(1.0,0.0));
int ApiMain()
{
float x,a=5.0,b=4.0,y,y1,y2;
float i,j;
window.Open();
assert(window.GetStatus() == WindowOpen);
window.RenderRectangle(Position(0.0,0.0), Position(28.0,20.0),
			   Magenta, false);
window.RenderLine(Position(14,0.0),Position(14.0,20.0),Black,0.08);
window.RenderLine(Position(0.0,10.0),Position(28.0,10.0),Black,0.08);
window.RenderLine(Position(0.0,15.0),Position(28.0,15.0),Black,0.05);
window.RenderLine(Position(21.0,0.0),Position(21.0,20.0),Black,0.05);
for (i=0.0;i<=13.5;i+=0.5)
{
window.RenderLine(Position(i,0.0),Position(i,10.0),Red,0.0);


}
for (i=0.0;i<=9.5;i+=0.5)
{
window.RenderLine(Position(0.0,i),Position(14.0,i),Black,0.0);
window.RenderLine(Position(0.0,5.0),Position(28.0,5.0),Black,0.05);


}
window.RenderLine(Position(7.0,0.0),Position(7.0,20.0),Black,0.05);
for(i=-4.5;i<=4.5;i+=.0001)
{
y=sin(i);
y1=cos(i);
window.RenderLine(Position(7.0,5.0)+Position(i,-y),Position(7.0,5.0)+Position(i,-y),Blue,0.0);
window.RenderLine(Position(7.0,5.0)+Position(i,-y1),Position(7.0,5.0)+Position(i,-y1),Blue,0.0);
}
for (i=-2.0;i<=4.0;i+=0.2)
{
y=sin(i);
y1=cos(i);
window.RenderLine(Position(7.0,5.0)+Position(i,-y),Position(7.0,5.0)+Position(i,-y1),Black,0.05);

}

for(i=-5;i<=5;i+=.0001)
{

y=(b/a)*sqrt(a*a-i*i);
y1=-(b/a)*sqrt(a*a-i*i);

window.RenderLine(Position(21.0,5.0)+Position(i,-y),Position(21.0,5.0)+Position(i,-y),Blue,0.0);
window.RenderLine(Position(21.0,5.0)+Position(i,-y1),Position(21.0,5.0)+Position(i,-y1),Blue,0.0);

}

for (i=0;i<=5;i+=.0001)
{
y=sqrt(4*i);
y1=-sqrt(4*i);
window.RenderLine(Position(21.0,5.0)+Position(i,-y),Position(21.0,5.0)+Position(i,-y),Blue,0.0);
window.RenderLine(Position(21.0,5.0)+Position(i,-y1),Position(21.0,5.0)+Position(i,-y1),Blue,0.0);
window.RenderLine(Position(21.0,5.0)+Position(-i,y1),Position(21.0,5.0)+Position(-i,y1),Blue,0.0);
window.RenderLine(Position(21.0,5.0)+Position(-i,y),Position(21.0,5.0)+Position(-i,y),Blue,0.0);
}
for(j=-2.88;j<=2.88;j+=0.2)
{
y=sqrt(4*j);
y1=-sqrt(4*j);
window.RenderLine(Position(21.0,5.0)+Position(j,-y),Position(21.0,5.0)+Position(j,-y1),Black,0.05);
window.RenderLine(Position(21.0,5.0)+Position(-j,y),Position(21.0,5.0)+Position(-j,y1),Black,0.05);

}

for(j=2.88;j<=5.0;j+=0.2)
{
y=(b/a)*sqrt(a*a-j*j);
y1=-(b/a)*sqrt(a*a-j*j);
window.RenderLine(Position(21.0,5.0)+Position(j,-y),Position(21.0,5.0)+Position(j,-y1),Black,0.05);
window.RenderLine(Position(21.0,5.0)+Position(-j,y),Position(21.0,5.0)+Position(-j,y1),Black,0.05);

}
}
